#ifndef ___SERIAL_H___
#define	___SERIAL_H___

#ifdef __cplusplus
extern "C" {
#endif
#include "analysis.h"

//#define PC_DEBUG 

#ifdef PC_DEBUG
#define SERIAL_DEV "/dev/ttyUSB0"
#else
#define SERIAL_DEV "/dev/ttyACM0"
#endif
#define MAX_BUFFER	2048


struct serial_frame 
{
	int dev;
	int baudreate;
	int flag;
	
};

extern int uart_485;
extern int uart_ac;
extern int uart_bd;



/*
 * function abstruct : uart initialization
 * parameter illustration: 
 *		[com]: uart number,[baudrate]: baud rate, [databit]: data bit
 *		[stopbit]: stop bit, [parity]: parity
 */
int uart_init(int com, int baudrate, int databit, int stopbit, char parity, int * dev);

void * uartac_receive_thread(void * param);
void * uart_send_thread(void * param);
void * uartbd_receive_thread(void * param);

int serial_uart1_open();
void uart485_send(int dev, unsigned char * data, int len);
void uart485_send_to_dtu(struct package * src);


#ifdef __cplusplus
}
#endif

#endif /* ___SERIAL_H___ */
